const webpack = require('webpack');
const path = require('path');
const webpackConfig = {
    entry: {
        'pageA': './src/pageA',
        'pageB': './src/pageB',
        vendor: ['jquery']
    },
    output: {
        path: path.resolve(__dirname, './dist'),
        filename: '[name].bundle.js'
    },
    plugins: [
        new webpack.optimize.CommonsChunkPlugin({
            names: ['vendor', 'manifest'],
            minChunks: Infinity //设置最小重复度，方便提出公共模块
        }),
        new webpack.optimize.CommonsChunkPlugin({
            name: 'common',
            chunks: ['pageA', 'pageB'] //约束提出范围
        })
    ]
};

module.exports = webpackConfig;